package Constraints.Impl;

import Constraints.IConstraint;
import Core.ErrorMessage;
import Model.Draw.Point;
import java.util.ArrayList;
import java.util.List;

/**
 * Projeto de TCC: Editor de Diagramas de comunicação BlueJ
 * @author Jose
 */
public class ActorConstraint implements IConstraint {

    @Override
    public List<ErrorMessage> Validate(Object obj) {
        List<ErrorMessage> errors = new ArrayList<ErrorMessage>();
        List<Object> elements = (List<Object>) obj;

        try {
            Point sourcePoint = (Point) elements.get(0);
        } catch (Exception e) {
            errors.add(new ErrorMessage("ActorEntity", "ERRO PADRAO PARA ATOR. REFAZER"));
        }

        if (elements.size() >= 2) {
            try {
                Point targetPoint = (Point) elements.get(1);
            } catch (Exception e) {
                errors.add(new ErrorMessage("ActorENtity", "ERRO PADRAO 2 PARA ATOR. REFAZER"));
            }
        }
        return errors.isEmpty() ? null : errors;
    }
}